import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {useUserStore} from "@/store/modules/user";
//列表数据
export const columns: BasicColumn[] = [
  /*{
    title: '数据终端id',
    align:"center",
    dataIndex: 'terminalId'
  },*/

  {
    title: '数据终端名称',
    align:"center",
    dataIndex: 'terminalName'
  },
   {
    title: '传感器编号',
    align:"center",
    dataIndex: 'deviceNo'
   },
   {
    title: '传感器名称',
    align:"center",
    dataIndex: 'deviceName'
   },
  {
    title: '时间',
    align:"center",
    dataIndex: 'createTime'
  },
  {
    title: '电池电压',
    align:"center",
    dataIndex: 'voltage'
  },
   {
    title: '温度最大值',
    align:"center",
    dataIndex: 'temperatureMax'
   },
   {
    title: '温度最小值',
    align:"center",
    dataIndex: 'temperatureMin'
   },
   {
    title: '局放最大值',
    align:"center",
    dataIndex: 'pdMax'
   },
   {
    title: '局放最小值',
    align:"center",
    dataIndex: 'pdMin'
   },
   {
    title: '最大频率值',
    align:"center",
    dataIndex: 'mostFrequentDb'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "创建日期",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
	{
      label: "数据终端编号",
      field: 'deviceNo',
      component: 'Input',
      //colProps: {span: 6},
 	},
  {
    label: "数据终端",
    field: 'terminalId',
    component: 'JSearchSelect',
    componentProps:{
      dict:"terminal,name,id,sys_org_code like '"+ useUserStore().getUserInfo.orgCode+"%'",
      adjustY: true,
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
 /* {
    label: '数据终端',
    field: 'terminalId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '数据终端id!'},
          ];
     },
  },*/
  {
    label: '数据终端名称',
    field: 'terminalName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '数据终端名称!'},
      ];
    },
  },
  {
    label: '传感器编号',
    field: 'deviceNo',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '传感器编号!'},
      ];
    },
  },
  {
    label: '传感器名称',
    field: 'deviceName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '传感器名称!'},
      ];
    },
  },
  {
    label: '上报时间',
    field: 'createTime',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '上报时间!'},
      ];
    },
  },
  {
    label: '电池电压',
    field: 'voltage',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '电池电压!'},
      ];
    },
  },
  {
    label: '最大温度',
    field: 'temperatureMax',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '最大温度!'},
      ];
    },
  },
  {
    label: '最小温度',
    field: 'temperatureMin',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '最小温度!'},
      ];
    },
  },
  {
    label: '最大局放',
    field: 'pdMax',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '最大局放!'},
      ];
    },
  },
  {
    label: '最小局放',
    field: 'pdMin',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '最小局放!'},
      ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
